import 'package:flutter/material.dart';
import 'package:flutter_demo/chapter8-EventNotification/event-mechanism/HitTestBlocker.dart';

void main() {
  runApp(MaterialApp(
    home: Scaffold(
      appBar: AppBar(
        title: const Text("Event Widget Demo"),
      ),
      body: DragConflictWidget(),
    ),
  ));
}

class DragConflictWidget extends StatefulWidget {
  @override
  _GestureDetectorWidget createState() => _GestureDetectorWidget();
}

class _GestureDetectorWidget extends State<DragConflictWidget> {
  double _left = 0.0;

  @override
  Widget build(BuildContext context) {
    return Stack(
      children: <Widget>[
        Positioned(
          left: _left,
          child: GestureDetector(
            child: const CircleAvatar(child: Text('A'),),
            onHorizontalDragUpdate: (DragUpdateDetails details) {
              setState(() => _left += details.delta.dx);
            },
            onHorizontalDragEnd: (details) {
              print('onHorizontalDragEnd');
            },
            onTapDown: (details) => print('onTapDown'),
            onTapUp: (details) => print('onTapUp'),
          ),
        ),
      ],
    );
  }
}
